package cn.ysym.dao;

import android.content.Context;

import java.util.List;

import cn.ysym.model.Setting;

/**
 * Created by Administrator on 2016/12/19 0019.
 */

public class SettingDao extends DaoBase {

    public SettingDao(Context context) {
        super(context);
    }

    public Setting query(String settingType) {
        List<String[]> objs = this.query(1, "select settingValue from setting where settingType = ?", settingType);
        if (objs.size() > 0) {
            Setting ret = new Setting();
            ret.setSettingType(settingType);
            ret.setSettingValue(objs.get(0)[0]);
            return ret;
        }

        return null;
    }

    public void update(Setting model) {
        this.execSql("update setting set settingValue = ? where settingType = ?", model.getSettingValue(), model.getSettingType());
    }
}
